--- 几点开始，间隔多少小时
---@param sh any 设定几点开始
---@param siv any 设定间隔多少小时
---@param cH any  当前几点
function getNextAlarmH(sh, siv, cH)
    local nH = sh
    while true do
        if nH > cH then break end
        nH = nH + siv
    end
    if (nH > 24) then nH = sh end
    return nH
end


function getNextAlarmM(sh, siv, cH, cMin)
    local nH = sh*60
    local cM = cH*60+cMin
    while true do
        if nH > cM then break end
        nH = nH + siv
    end
    if (nH >= 24*60) then nH = sh*60 end
    return  math.floor(nH / 60), nH % 60
end


-- print(getNextAlarmH(2, 1, 15))
print(getNextAlarmM(1, 720, 5, 50))
